﻿using System;
using Medianamik.Core;
using System.Linq;

namespace Medianamik.DummyWebSite
{
    public partial class index : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

		protected void ApplyFirstSettings_Click(object sender, EventArgs e)
		{
			lblResult.Text = "";

            
			try
			{
				//Appliquer l'ensemble des patches à la base de données courrante
				var changes = ConfigManager.GetSchemaChangesMerged()
					.Where(c => !c.DateApplied.HasValue);

				foreach (var change in changes)
					ConfigManager.ApplySchemaChange(change);

				lblResult.Text = "Application des patchs réussi!";
			}
			catch (Exception exc)
			{
				lblResult.Text = "Erreur lors de l'application des patchs : " + exc.Message;
			}
		}
    }

   

}
